<template>
  <div class="tab-bar">
    <div class="item" @click="changeTab(0)"><router-link to="/index" tag="span" :class="tabIndex==0?'active':''">首页</router-link></div>
    <div class="item" @click="changeTab(1)"><router-link to="/follow" tag="span" :class="tabIndex==1?'active':''">同城</router-link></div>
    <div class="item" @click="changeTab(2)"><router-link to="/publish" tag="span" class="btn"></router-link></div>
    <div class="item" @click="changeTab(3)"><router-link to="/msg" tag="span" :class="tabIndex==3?'active':''">消息</router-link></div>
    <div class="item" @click="changeTab(4)"><router-link to="/me" tag="span" :class="tabIndex==4?'active':''">我</router-link></div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      tabIndex:0
    }
  },
  methods: {
    changeTab (index) {
      this.tabIndex = index
    }
  }
}
</script>
<style scoped>
  .tab-bar{
    height: 50px;
    line-height: 50px;
    width: 100%;
    background: #000;
    position: fixed;
    bottom: 0;
    left: 0;
    color: #cccccc;
    font-size: 16px;
    display: flex;
    text-align: center;
    z-index: 9;
  }
  .tab-bar .item{
    flex: 1;
    text-align: center;
  }
  .tab-bar .item .active{
    color: #ffffff;
  }
  .tab-bar .item .btn{
    display: block;
    width: 40px;
    height: 30px;
    background-color: #ffffff;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -20px;
    margin-top: -15px;
    border-radius: 25%;
  }
  .tab-bar .item .btn::after{
    content: '+';
    color: black;
    font-size: 2em;
    position: absolute;
    left: 9px;
    top: -11px;
  }
</style>